<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<%@page import="com.lmpop.trade.ts_custclass.*" %>
<%@page import="com.lmpop.trade.ti_rightinfo.*" %>
<% 
	String in_staff_id="",selectStr="",cust_class="",start_date="2010-01-01",end_date="2050-01-01";	
	if( session.getAttribute("session_user_id") != null )
	{
		in_staff_id = session.getAttribute("session_user_id").toString();
	}
	
		String checked_menu_id = "";
		
	String flag = "0";// 0 = add 1 = update 
	if (request.getParameter("flag") != null) {
		flag = request.getParameter("flag");
	}
	if (request.getParameter("cust_class") != null) {
		cust_class = request.getParameter("cust_class");
		List rightInfo = new Ti_rightinfoInfo().getListByPk(cust_class);
			if(rightInfo != null && rightInfo.size() > 0){   
			for(int i=0;i<rightInfo.size();i++){
				Hashtable menuMap = (Hashtable)rightInfo.get(i);
				if(menuMap.get("menu_id")!=null){
					checked_menu_id = menuMap.get("menu_id").toString() + "," + checked_menu_id;
				}
				if(menuMap.get("start_date")!=null){
					start_date = menuMap.get("start_date").toString() ;
					if(start_date.length() > 10)start_date=start_date.substring(0,10);
				}
				if(menuMap.get("end_date")!=null){
					end_date = menuMap.get("end_date").toString() ;
					if(end_date.length() > 10)end_date=end_date.substring(0,10);
				}				
			}
		}
			
	}
	
	Ts_custclassInfo ts_custclassInfo = new Ts_custclassInfo();
	String cust_class_name = ts_custclassInfo.getcust_class_name(cust_class);
	
	String classtype = "",class_type="";
	if(request.getParameter("classtype")!=null) classtype = request.getParameter("classtype");
	if(request.getParameter("class_type")!=null) class_type = request.getParameter("class_type");
	String search_cust_class = "",search_cust_class_name="";
	if(request.getParameter("s_cust_class")!=null && !request.getParameter("s_cust_class").equals("")){
		search_cust_class = request.getParameter("s_cust_class");
	}
	if(request.getParameter("s_cust_class_name")!=null && !request.getParameter("s_cust_class_name").equals("")){
		search_cust_class_name = request.getParameter("s_cust_class_name");
	}
	String iStart = "0";
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	String para ="";
	if(classtype.equals("c")){
	para ="/program/admin/custclass/index.jsp?s_cust_class_name="+search_cust_class_name+"&s_cust_class="+search_cust_class+"&iStart="+Integer.parseInt(iStart);
	}
	
	
	
%>

<html>
  <head>
    <title>级别权限信息</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/jquery.js"></script>
	<script type="text/javascript" src="rightinfo.js"></script>
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
	
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/interface/Ti_rightinfoInfo.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=request.getContextPath()%>/dwr/util.js'></script>
</head>

<body>
	<h1>级别权限信息</h1>

	<form action="/doTradeReg.do" method="post" name="addForm">
	
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
		
		<tr>
		<td align="right" width="15%">
			级别名称:
		</td>	
		<td colspan="3">
		<input name="cust_class_name" id="cust_class_name" value="<%=cust_class_name%>" type="text" />
		</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				菜单权限<font color="red">*</font>
			</td>
			<td colspan="3">
			<div id=menu><img src=/program/admin/images/wait.gif border=0><font size=2> 加载中 . . .</font>
			</div>
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				权限有效起始时间:
			</td>
			<td>
			
			<input name="start_date" type="text" id="start_date" class="Wdate" value="<%=start_date%>" onClick="WdatePicker({maxDate:'#F{$dp.$D(\'end_date\',{d:-1})}',readOnly:true})" size="15" />
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				权限有效截止时间:
			</td>
			<td>
			<input name="end_date" id="end_date" type="text" class="Wdate" value="<%=end_date%>" onClick="WdatePicker({minDate:'#F{$dp.$D(\'start_date\',{d:1})}',readOnly:true})" size="15"/>
			
			</td>
		</tr>
		


		<tr>
			<td align="right" width="10%">
				备注:
			</td>
			<td><input name="remark" id="remark" type="text" /></td>
		</tr>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input type="hidden" name="bpm_id" id="bpm_id"  value="2128" />
				<input type="hidden" name="cust_class" id="cust_class"  value="<%=cust_class%>" />
				<input name="in_staff_id" id="in_staff_id" type="hidden" value="<%=in_staff_id%>" />
				<input name="flag" id="flag" type="hidden" value="<%=flag%>" />
				<input name="in_date" id="in_date" type="hidden"  value="" />
				<input name="menu_id" id="menu_id" type="hidden"/>
				<input name="right_attr" id="right_attr" type="hidden"  value=""/>
				<input type="hidden" name="jumpurl" value="<%=para%>" />
				<input type="hidden" name="class_type" value="<%=class_type%>" />
				<input name="checked_menu_id" id="checked_menu_id" type="hidden"  value=<%=checked_menu_id%> />
				<input type="button" class="buttoncss" name="tradeSub" onClick="return tijao()" value="提交" />&nbsp;&nbsp;
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onClick="window.location.href='<%=para%>';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
<script>right()</script>